using System;
using System.IO;

namespace Pinwheel.LSerialize
{
    public unsafe interface ILStreamBuffer
    {
        bool IsValid { get; }
        
        int Size { get; }
        int Index { get; }
        int Free { get; }

        int Tail { get; }
        byte* Head { get; }
        byte* Current { get; }

        static ILStreamBuffer Create(int length) { return null; }

        static ILStreamBuffer Create(byte* source, int size) { return null; }
        
        int GetHashCode();

        int Seek(int offset, SeekOrigin loc);
        
        void Clear();

        void Reset(int size);

        void Dispose();
    }

    public unsafe interface ILStreamBufferWriter : ILStreamBuffer, IDisposable
    {
        byte this[int i] { get; set; }

        int PushByte(byte value);

        int PushBytes(byte[] bytes);

        int PushBytes(byte* source, int size);

        void EnsureSize(int size);
        
        private void Allocate(int size) { }
    }

    public interface ILStreamBufferReader : ILStreamBuffer
    {
        byte this[int i] { get; }
        
        byte PopByte();
        
        byte[] PopBytes(int size);
        
        bool EnsureTail(int size);
    }
}